#!/bin/bash
#
# Copyright 2009 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: lijian@google.com (Jian Li)
# $Id$

# remove dir
rm /tmp/phpbbplugin -fr
mkdir /tmp/phpbbplugin/includes/auth /tmp/phpbbplugin/styles/prosilver/template -p
rm /tmp/phpbbsrc -fr
mkdir /tmp/phpbbsrc
mkdir /tmp/phpbbsrc/includes/auth /tmp/phpbbsrc/styles/prosilver/template -p

wwwphp_dir="/home/muthup/phpbbplugin"
phpsrc_dir="/home/muthup/phpBB3"
phpplugin_dir="/tmp/phpbbplugin"
phptmpsrc_dir="/tmp/phpbbsrc"

cp $wwwphp_dir/includes/functions_user.php $phpplugin_dir/includes/
cp $wwwphp_dir/includes/auth/auth_db.php $phpplugin_dir/includes/auth/
cp $wwwphp_dir/styles/prosilver/template/index_body.html $phpplugin_dir/styles/prosilver/template
cp $wwwphp_dir/styles/prosilver/template/login_body.html $phpplugin_dir/styles/prosilver/template
cp $wwwphp_dir/styles/prosilver/template/login_forum.html $phpplugin_dir/styles/prosilver/template
cp $wwwphp_dir/styles/prosilver/template/login_friendconnect.html $phpplugin_dir/styles/prosilver/template
cp $wwwphp_dir/styles/prosilver/template/overall_header.html $phpplugin_dir/styles/prosilver/template
cp $wwwphp_dir/styles/prosilver/template/overall_footer.html $phpplugin_dir/styles/prosilver/template


cp $phpsrc_dir/includes/functions_user.php $phptmpsrc_dir/includes
cp $phpsrc_dir/includes/auth/auth_db.php $phptmpsrc_dir/includes/auth
cp $phpsrc_dir/styles/prosilver/template/index_body.html $phptmpsrc_dir/styles/prosilver/template
cp $phpsrc_dir/styles/prosilver/template/login_body.html $phptmpsrc_dir/styles/prosilver/template
cp $phpsrc_dir/styles/prosilver/template/login_forum.html $phptmpsrc_dir/styles/prosilver/template
cp $phpsrc_dir/styles/prosilver/template/overall_header.html $phptmpsrc_dir/styles/prosilver/template
cp $phpsrc_dir/styles/prosilver/template/overall_footer.html $phptmpsrc_dir/styles/prosilver/template


diff -cNr $phptmpsrc_dir $phpplugin_dir > /tmp/plugin.patch

# cd /var/www/phpbb
# patch -p3 -i /tmp/plugin.patch

